<template>
    <!-- 查询框 -->
    <a-card :bordered="false">
        <div class="table-page-search-wrapper">
            <a-form layout="inline" :form="form">
                <a-row :gutter="48">
                    <a-col :md="8" :sm="24">
                        <a-form-item label="集团卡号">
                            <a-input placeholder="请输入集团卡号"
                                v-decorator="['groupCardNo', { rules: [{ required: true, message: '请输入集团卡号' }] }]" />
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <a-form-item label="品牌">
                            <a-select placeholder="请选择品牌"
                                v-decorator="['weid', { rules: [{ required: true, message: '请选择品牌' }] }]">
                                <a-select-option v-for="item in brands" :key="item.weid" :value="item.weid">
                                    {{ item.name }}</a-select-option>
                            </a-select>
                        </a-form-item>
                    </a-col>
                    <a-col :md="8" :sm="24">
                        <span class="table-page-search-submitButtons">
                            <a-button type="primary" @click="getData">查询</a-button>
                        </span>
                    </a-col>
                </a-row>
            </a-form>
        </div>
        <div style="margin-top:15px">
      <a-table :columns="columns" :dataSource="list" :bordered  =true :pagination=false
        :rowKey="(record,index) => index" :loading="loading">

      </a-table>
    </div>
    </a-card>
</template>


<script>
import { queryReason } from '@/api/operateTools/index'
import { brands } from '../../micromall/util/brand';

const columns = [{
  title: '不可用原因',
  dataIndex: 'reason'
}, {
  title: '时间',
  dataIndex: 'useDate'
}];

export default {
    data() {
        return {
            brands,
            columns,
            form: this.$form.createForm(this),
            loading: false,
            list:[]
        }
    },
    methods: {
        // 查询数据
        getData(e) {
            e.preventDefault()
            this.form.validateFields((err, values) => {
                if (!err) {
                    console.log('Received values of form: ', values)
                    queryReason(values).then(res => {
                        if(res.code == 200){
                            this.list = res.data
                        }else{
                            this.$message.error(res.msg)
                        }
                        console.log(res)
                    }).catch(err =>{
                        console.log(err)
                    })
                }
            })
        },
    },
}
</script>

<style scoped>

</style>